Release 10.1A: OpenEdge Development:
Basic Database Tools


Creating a trigger

There are two types of triggers: session and schema. You create session triggers as part of a Progress 4GL procedure and create schema triggers using the Data Dictionary. See OpenEdge Development: Progress 4GL Handbook for information about creating session triggers.

There are two types of schema triggers: table and field.

To create a table trigger:

  1. Choose Schema Add New Table or choose Schema Modify Table. If you are adding a new table, specify a table name. If you are modifying a table, the Data Dictionary alphabetically lists all the tables defined for your database. Select the table for which you want to create the trigger.
  2. Choose Triggers. The Table Triggers dialog box appears.
  3. Define the trigger attributes. For more information on the Table Triggers dialog box and the trigger attributes, see the "Table Triggers" section.
  4. Specify whether a session trigger can override this schema trigger. For more information about session and schema triggers, see the chapter on database triggers in OpenEdge Development: Progress 4GL Handbook .
  5. Specify whether the database engine checks the cyclical redundancy check (CRC) code for the trigger.
  6. Press PUT to enter the trigger code. The Data Dictionary displays the Trigger Code dialog box.
  7. Enter the trigger code.
  8. Choose OK to return to the Table Triggers dialog box.
  9. Choose OK to return to the Add Table or Modify Table window.

To create a field trigger from an existing field:

  1. Choose Schema Field Editor. The Field Editor alphabetically lists all the tables defined for your database.
  2. Select the table that contains the field for which you want to create the trigger. The Field Editor window appears.
  3. Choose Triggers.
  4. Select the field for which you want to define the trigger. The Field Triggers dialog box appears:
  5. Specify the name of the trigger procedure, then press PUT to enter the trigger code. The Trigger Editor appears.
  6. Specify whether a session trigger can override the schema trigger. For more information about session and schema triggers, see the chapter on database triggers in the OpenEdge Development: Progress 4GL Handbook .
  7. Specify whether the database engine verifies the cyclical redundancy check (CRC) code.
  8. Choose OK to create the trigger and return to the Field Editor.
  9. Note: To generate r-code for schema trigger definitions, you must define the trigger procedure in the Data Dictionary tool, then compile and save the r-code with the Application Compiler.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095